package system.security.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="se_authority")
public class Authority  {
	
	protected Integer id;
	protected Resource resource;
	protected AuthorityType authorityType;
	
	public Authority(){
		super();
	}
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
	@JoinColumn(name="resource_id")
	public Resource getResource() {
		return resource;
	}
	public void setResource(Resource resource) {
		this.resource = resource;
	}
	
	@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
	@JoinColumn(name="authority_type_id")
	public AuthorityType getAuthorityType() {
		return authorityType;
	}
	public void setAuthorityType(AuthorityType authorityType) {
		this.authorityType = authorityType;
	}
	
}
